package com.dstats.fragments;

import java.util.ArrayList;
import java.util.List;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTabHost;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.dstats.R;

public class VodsParentFragment extends Fragment {
	
	private FragmentTabHost tabHost;
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
    	super.onCreate(savedInstanceState);
		
    	   View rootView = inflater.inflate(R.layout.tab_host_horizontal, container, false);
    	tabHost = (FragmentTabHost) rootView.findViewById(android.R.id.tabhost);
    	
    	tabHost.setup(getActivity(), getChildFragmentManager(), R.id.tab_container);
    	
    	tabHost.addTab(tabHost.newTabSpec("Tab4").setIndicator(getString(R.string.general)),
    			VodGeneral.class, null);

    	tabHost.addTab(tabHost.newTabSpec("Tab1").setIndicator(getString(R.string.highLights)),
    			VodHighlights.class, null);

    	tabHost.addTab(tabHost.newTabSpec("Tab2").setIndicator(getString(R.string.games)),
    			VodGames.class, null);
    	
    	tabHost.addTab(tabHost.newTabSpec("Tab3").setIndicator(getString(R.string.fun)),
    			VodFun.class, null);


    	
    	
    	return rootView;
	}

	
	
	public static class VodHighlights extends VodsFragment{

		private static FetchYouTube fetch;
		
		@Override
		protected void fetch() {
			if(fetch==null){
				fetch = new FetchYouTube(getUrl());
				fetch.execute();
			}
		}
		
		@Override
		protected String getVodTag() {
			return "highlights";
		}
		
		@Override
		protected List<String> getUrl() {
			List<String> list = new ArrayList<String>();
			list.add("http://gdata.youtube.com/feeds/base/users/MidasHim/uploads?orderby=updated&alt=rss");
			list.add("http://gdata.youtube.com/feeds/base/users/NoobFromUA/uploads?orderby=updated&alt=rss");
			list.add("http://gdata.youtube.com/feeds/base/users/diesmiling666/uploads?orderby=updated&alt=rss");
			list.add("http://gdata.youtube.com/feeds/base/users/beckkkj/uploads?orderby=updated&alt=rss");
			list.add("http://gdata.youtube.com/feeds/base/users/wiiddzz/uploads?orderby=updated&alt=rss");
			
			return list;
		}


		
	}
	
	public static class VodGames extends VodsFragment{

		private static FetchYouTube fetch;
		
		@Override
		protected void fetch() {
			if(fetch==null){
				fetch = new FetchYouTube(getUrl());
				fetch.execute();
			}
		}
		
		@Override
		protected String getVodTag() {
			return "games";
		}
		
		@Override
		protected List<String> getUrl() {
			List<String> list = new ArrayList<String>();
			list.add("http://gdata.youtube.com/feeds/base/users/beyondthesummittv/uploads?orderby=updated&alt=rss");
			list.add("http://gdata.youtube.com/feeds/base/users/joinDOTA/uploads?orderby=updated&alt=rss");
			list.add("http://gdata.youtube.com/feeds/base/users/DotaCinemaVODS/uploads?orderby=updated&alt=rss");
			list.add("http://gdata.youtube.com/feeds/base/users/Dota2Tournaments/uploads?orderby=updated&alt=rss");
			
			return list;
		}
		
	}

	public static class VodFun extends VodsFragment{

		private static FetchYouTube fetch;
		
		@Override
		protected void fetch() {
			if(fetch==null){
				fetch = new FetchYouTube(getUrl());
				fetch.execute();
			}
		}
		
		@Override
		protected String getVodTag() {
			return "fun";
		}
		
		@Override
		protected List<String> getUrl() {
			List<String> list = new ArrayList<String>();
			list.add("http://gdata.youtube.com/feeds/base/users/DarduinMyMenlon/uploads?orderby=updated&alt=rss");
			list.add("http://gdata.youtube.com/feeds/base/users/nigmanoname/uploads?orderby=updated&alt=rss");
			list.add("http://gdata.youtube.com/feeds/base/users/Dotapoop69/uploads?orderby=updated&alt=rss");
			
			return list;
		}
		
	}
	
	public static class VodGeneral extends VodsFragment{

		private static FetchYouTube fetch;
		
		@Override
		protected void fetch() {
			if(fetch==null){
				fetch = new FetchYouTube(getUrl());
				fetch.execute();
			}
		}
		
		@Override
		protected List<String> getUrl() {
			List<String> list = new ArrayList<String>();
			list.add("http://gdata.youtube.com/feeds/base/users/hOlyhexOr/uploads?orderby=updated&alt=rss");
			list.add("http://gdata.youtube.com/feeds/base/users/DotaCinema/uploads?orderby=updated&alt=rss");
			list.add("http://gdata.youtube.com/feeds/base/users/Dotapoop69/uploads?orderby=updated&alt=rss");
			list.add("http://gdata.youtube.com/feeds/base/users/DoubleClickDota2/uploads?orderby=updated&alt=rss");
			list.add("http://gdata.youtube.com/feeds/base/users/natusvinceretv/uploads?orderby=updated&alt=rss");
			list.add("http://gdata.youtube.com/feeds/base/users/PurgeGamers/uploads?orderby=updated&alt=rss");
			list.add("http://gdata.youtube.com/feeds/base/users/LuminousInverse/uploads?orderby=updated&alt=rss");
			list.add("http://gdata.youtube.com/feeds/base/users/WronchiAnimation/uploads?orderby=updated&alt=rss");
			list.add("http://gdata.youtube.com/feeds/base/users/WehSing/uploads?orderby=updated&alt=rss");
			
			return list;
		}

		@Override
		protected String getVodTag() {
			return "general";
		}
	}
	
	
}
